import { UseInterceptors } from '@nestjs/common';
import { ClassTransformOptions } from 'class-transformer';
import { SerializeInterceptor } from '../interceptor/serialize.interceptor';

interface ClassConstructor {
  new (...args: any[]): object;
}

export function Serialize(
  dto: ClassConstructor,
  options?: ClassTransformOptions,
) {
  return UseInterceptors(new SerializeInterceptor(dto, options));
}
